﻿using System;
using SharpKit.JavaScript;

namespace SharpKit.Onx
{
    /// <summary>
    /// A class that collects and emits information about the user's unlocking of the device.
    /// https://www.onx.ms/#apiPage/screen
    /// </summary>
    [JsType(Mode = JsMode.Prototype, Export = false)]
    public class Screen : Emitter
    {
        //No way to new this up
        private Screen()
        { }

        #region Properties
        /// <summary>
        /// Checks if the screen is on.
        /// </summary>
        [JsProperty(NativeField = true, Name = "isOn")]
        public bool IsOn { get { return false; } }

        /// <summary>
        /// Gets the status of the screen.
        /// </summary>
        [JsProperty(NativeField = true, Name = "status")]
        public ScreenSignal Status { get { return null; } }

        /// <summary>
        /// Checks if the lock screen is currently showing.
        /// </summary>
        [JsProperty(NativeField = true, Name = "isLocked")]
        public bool IsLocked { get { return false; } }
        #endregion

        #region Triggers (Events)
        /// <summary>
        /// trigger is received when device's screen is turned off. Additional trigger data is available in the ScreenSignal parameter passed to the callback function.
        /// </summary>
        public new event Action Off
        {
            [JsMethod(Name = "on", InsertArg0 = "'off'")]
            add
            {
            }
            [JsMethod(Name = "removeListener", InsertArg0 = "'off'")]
            remove
            {
            }
        }

        /// <summary>
        /// trigger is received when device's screen is turned on. Additional trigger data is available in the ScreenSignal parameter passed to the callback function.
        /// </summary>
        public new event Action On
        {
            [JsMethod(Name = "on", InsertArg0 = "'on'")]
            add
            {
            }
            [JsMethod(Name = "removeListener", InsertArg0 = "'on'")]
            remove
            {
            }
        }

        /// <summary>
        /// trigger is received when device's screen is unlocked. Additional trigger data is available in the ScreenSignal parameter passed to the callback function.
        /// </summary>
        public event Action Unlock
        {
            [JsMethod(Name = "on", InsertArg0 = "'unlock'")]
            add
            {
            }
            [JsMethod(Name = "removeListener", InsertArg0 = "'unlock'")]
            remove
            {
            }
        }
        #endregion
    }

    /// <summary>
    /// Holds the state of the screen. This class represents the screen's current state and will be triggered on state changes.
    /// </summary>
    [JsType(JsMode.Prototype, Export = false)]
    public class ScreenSignal
    {
        //No way to new this up
        private ScreenSignal()
        { }

        /// <summary>
        /// Checks if the screen is on.
        /// </summary>
        [JsProperty(NativeField = true, Name = "isOn")]
        public bool IsOn { get { return false; } }

        /// <summary>
        /// Checks if the lock screen is currently showing.
        /// </summary>
        [JsProperty(NativeField = true, Name = "isLocked")]
        public bool IsLocked { get { return false; } }
    }
}